// February 6, 1997
// Notes Application
application "paperroll" called "Notes"

// Notes Soup
soup "Notes" called "Notes" of "paperroll" range "optionalDateRange"

overview "notes:date" called "Par Date" of "Notes" queries "timestamp" contains
	{
	column "Date" width 115 is timestamp
	column "Titre de Note" width 200 is title
	}

class "paperroll" called "Note" of "Notes" contains
	{
	data: note called "Note" with options { "required" "automatic" }
	title: string called "Titre"
	timestamp: datetime called "Date" default ""
	viewstationery := symbol "paperroll"
	height := value 200
	}
	
class "checkList" called "Check List" of "Notes" contains
	{
	timestamp: datetime called "Date" default ""
	title: string called "Titre"
	topics: array called "Sujets" with options { "checklistnote" "required" } { entry called "Topic" contains
			{
			mtgdone: boolean called "Marqu" default "O"
			hideCount: integer called "Hide Count" default "0"
			level: integer called "Niveau" default "1"
			text: text called "Texte" with options { "automatic" }
			viewbounds := bounds { 0 0 200 30 }
			}
		}
	viewstationery := symbol "paperroll"
	height := value 200
	data := nil
	}
	
class "list" called "Schma" of "Notes" contains
	{
	timestamp: datetime called "Date" default ""
	title: string called "Titre"
	topics: array called "Sujets" with options { "outlinenote" "required" } { entry called "Topic" contains
			{
			hideCount: integer called "Hide Count" default "0"
			level: integer called "Niveau" default "1"
			text: text called "Texte" with options { "automatic" }
			viewbounds := bounds { 0 0 200 30 }
			}
		}
	viewstationery := symbol "paperroll"
	height := value 200
	data := nil
	}


// Names Application
application "cardfile" called "Noms"

soup "Names" called "Noms" of "cardfile" range "textRange"

overview "names:phones" called "Liste de Tl" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nom" width 150 is sortOn
	column "Tl" width 117 is [ phones, 0 ]
	}
	
overview "names:email" called "Liste de E-Mail" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nom" width 150 is sortOn
	column "E-Mail" width 117 is email
	}

overview "names:company" called "Liste de Socits" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nom" width 150 is sortOn
	column "Socit" width 117 is company
	}
	
overview "names:bday" called "Liste d' Anniversaires" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nom" width 150 is sortOn
	column "Anniversaire" width 117 is bday
	}
	
class "Person" called "Personne" of { "cardfile" "Names" } contains
	{
	sortOn := format "%s %s" { name.last name.first }
	name: entry called "Nom" with options { "required" } contains
		{
		honorific: string called "M/Mme" with options { "automatic" }
		first: string called "Prnom" with options { "automatic" }
		last: string called "Nom" with options { "automatic" }
		}
		
	addresses: set called "Adresse" firststoredin || { entry called "Adresse" contains
			{
			address: string called "Rue"
			address2: string called "Rue2"
			city: string called "Ville"
			region: string called "Province/Etat"
			postal_code: string called "Code Postal"
			country: string called "Pays"
			}
		}
	
	companies: set called "Socit" firststoredin || { entry called "Socit" contains
			{	
			company: string called "Nom"
			title: string called "Titre"
			}
		}
		
	pagers: set called "Pager" { entry called "Pager" contains
			{
			pagerNum: string called "Pager" class "pagerClasses" with options { "titlefromclass" "firstclasswild" }
			pagerPIN: string called "Pager PIN"
			}
		}
		
	phones: set called "Tl" { string called "Tl" class "phoneClasses" with options { "titlefromclass" "firstclasswild" } }
	emailAddrs: set called "E-Mail" firststoredin || { entry called "E-Mail" contains
			{
			email: string called "EMail" class "mailClasses" with options { "titlefromclass" "firstclasswild" }
			}
		}
	bday: date called "Anniversaire"
	anniversary: date called "Anniversaire de mariage"
	notes: note called "Notes"
	cardType: integer called "Sorte de Carte"
	}


class "company" called "Socit" of { "cardfile" "Names" } contains
	{
	sortOn := format "%s" { company }
	company: string called "Socit" with options { "required" }
	names: set called "Nom" firststoredin name { entry called "Nom" contains
			{
			honorific: string called "M/Mme"
			first: string called "Prnom"
			last: string called "Nom"
			title: string called "Titre"
			}
		}
		
	addresses: set called "Adresse" firststoredin || { entry called "Adresse" contains
			{
			address: string called "Rue"
			address2: string called "Rue2"
			city: string called "Ville"
			region: string called "Province/Etat"
			postal_code: string called "Code Postal"
			country: string called "Pays"
			}
		}

	phones: set called "Tl" { string called "Tl" class "phoneClasses" with options { "titlefromclass" "firstclasswild" } }
	emailAddrs: set called "E-Mail" firststoredin email { string called "EMail" class "mailClasses" with options { "titlefromclass" "firstclasswild" } }
	notes: note called "Notes"
	cardType: integer called "Sorte de Carte"
	}


class "owner" called "Propritaire" of { "cardfile" "Names" } with options { "nofolders" } contains
	{
	labels := symbol "_ownerNames"
	sortOn := format "%s %s" { name.last name.first }
	name: entry called "Nom" with options { "required" } contains
		{
		honorific: string called "M/Mme" with options { "automatic" } 
		first: string called "Prnom" with options { "automatic" } 
		last: string called "Nom" with options { "automatic" } 
		}
		
	addresses: set called "Adresse" firststoredin || { entry called "Adresse" contains
			{
			address: string called "Rue"
			address2: string called "Rue"
			city: string called "Ville"
			region: string called "Province/Etat"
			postal_code: string called "Code Postal"
			country: string called "Pays"
			}
		}
	
	companies: set called "Socit" firststoredin || { entry called "Socit" contains
			{	
			company: string called "Nom"
			title: string called "Titre"
			}
		}
		
	pagers: set called "Pager" firststoredin || { entry called "Pager" contains
			{
			pagerNum: string called "Pager" class "pagerClasses" with options { "titlefromclass" "firstclasswild" }
			pagerPIN: string called "Pager PIN"
			}
		}
		
	phones: set called "Tl" { string called "Tl" class "phoneClasses" with options { "titlefromclass" "firstclasswild" } }
	emailAddrs: set called "E-Mail" firststoredin || { entry called "E-Mail" contains
			{
			email: string called "EMail" class "mailClasses" with options { "titlefromclass" "firstclasswild" }
			emailpassword: string called "Mot de passe"
			}
		}
	
	owner: entry called "Information de Propritaire" contains
			{
			bankAccounts: set called "Comte de Banque" { entry called "Comte de Banque" contains
					{
					bankAcctNum: string called "No. de Comte"
					bankContactNum: string called "Tl" class "phoneClasses" with options { "titlefromclass" "firstclasswild" }
					}
				}
				
			creditCards: set called "Carte de Crdit" { entry called "Carte de Crdit" contains
					{
					creditCardNum: string called "No. de Carte"
					creditCardName: string called "Nom" class "creditClasses" with options { "titlefromclass" "firstclasswild" }
					creditCardExpDate: date called "Date d' expiration"
					creditCardContactNum: string called "No. de Tl"
					}
			}
		}
		
	bday: date called "Anniversaire"
	anniversary: date called "Anniversaire de mariage"
	notes: note called "Notes"
	cardType: integer called "Sorte de Carte"
	}

class "worksite" called "Lieu de travail" of { "cardfile" "Names" } with options { "nofolders" } contains
	{
	labels := symbol "_ownerNames"
	sortOn:= format "%s" { place }
	place: string called "Lieu de travail" with options { "required" }
	areaCode: string called "Code rgional"
	dialingPrefix: string called "Indicatif"
	notes: note called "Notes"
	}
	
field class "creditClasses" |string.card| is "Carte" ""
field class "creditClasses" |string.card.phonecard| is "Carte de Tl." ""
field class "creditClasses" |string.card.creditcard| is "Carte de Crdit" ""
field class "creditClasses" |string.card.phonecard.att| is "AT&T" ""
field class "creditClasses" |string.card.phonecard.mci| is "MCI" ""
field class "creditClasses" |string.card.phonecard.sprint| is "Sprint" ""
field class "creditClasses" |string.card.creditcard.visa| is "VISA" ""
field class "creditClasses" |string.card.creditcard.mastercard| is "MasterCard" ""
field class "creditClasses" |string.card.creditcard.amex| is "AmEx" ""
field class "creditClasses" |string.card.creditcard.discover| is "Discover" ""

field class "pagerClasses" |string.pager| is "Pager" ""
field class "pagerClasses" |string.pager.skytel| is "SkyTel" ""
field class "pagerClasses" |string.pager.mobilecomm| is "MobileComm" ""
field class "pagerClasses" |string.pager.embarc| is "EMBARC" ""

field class "phoneClasses" otherPhone is "Tl" ""
field class "phoneClasses" homePhone is "Rsidence" "H"
field class "phoneClasses" workPhone is "Travail" "W"
field class "phoneClasses" faxPhone is "Fax" "F"
field class "phoneClasses" carPhone is "Voiture" "A"
field class "phoneClasses" mobilePhone is "Cellular" "C"
field class "phoneClasses" homeFaxPhone is "Fax de rsidence" "HF"

field class "mailClasses" |string.email| is "Email" ""
field class "mailClasses" |string.email.internet| is "Internet" ""
field class "mailClasses" |string.email.aol| is "America Online" ""
field class "mailClasses" |string.email.compuserve| is "CompuServe" ""
field class "mailClasses" |string.email.mcimail| is "MCI Mail" ""
field class "mailClasses" |string.email.attmail| is "AT&T Mail" ""
field class "mailClasses" |string.email.easylink| is "EasyLink" ""
field class "mailClasses" |string.email.prodigy| is "Prodigy" ""
field class "mailClasses" |string.email.genie| is "GEnie" ""
field class "mailClasses" |string.email.delphi| is "Delphi" ""
field class "mailClasses" |string.email.msn| is "Network" ""
field class "mailClasses" |string.email.interchange| is "Interchange" ""
field class "mailClasses" |string.email.radiomail| is "RadioMail" ""


// Calendar Application
// Note that the calendar application is written using metasoups as the 
// format is too complex and not really documented.
application "calendar" called "Calendrier" with options { "nofolders" }

// Calendar Metasoup
metasoup "calendar:metasoup:REVELAR" called "Runion" of "calendar" range "dateRange"

overview "meetings:date" called "Par Date" of "calendar:metasoup:REVELAR" queries "mtgStartDate" contains
	{
	column "Date" width 115 is mtgStartDate
	column "Dscription" width 200 is mtgText
	}

class "meeting" called "Runion" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: datetime called "Date" with options { "required" }
	mtgText: string called "Titre" with options { "required" }
	mtgDuration: integer called "Dure" with options { "required" }
	notes: note called "Notes"
	mtgAlarm: datetime called "Alarme"
	location: string called "Lieu" with options { "readonly" }
	invitees: set called "Invits" with options { "readonly" }
		{
		string called "Invit" with options { "readonly" }
		}
	}
	
class "repeatingMeeting" called "Runion repete" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: datetime called "Premier Jour" with options { "required" }
	mtgText: string called "Titre" with options { "required" }
	mtgDuration: integer called "Dure" with options { "required" }
	notes: note called "Notes"
	mtgAlarm: datetime called "Alarme"
	location: string called "Lieu" with options { "readonly" }
	invitees: set called "Invits" with options { "readonly" }
		{
		string called "Invit" with options { "readonly" }
		}
	mtgStopDate: date called "Jour Final"	
  repeats: string called "Rpete" class "repeatClasses" with options { "suffixfromclass" "displayifempty" "required" }
	}
	
class "CribNote" called "Evnement" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: date called "Premier jour" with options { "required" }
	mtgText: string called "Titre" with options { "required" }
	notes: note called "Notes"
	}
	
class "repeatingCribNote" called "Evenement rpt" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: date called "Premier jour" with options { "required" }
	mtgText: string called "Titre" with options { "required" }
	notes: note called "Notes"
	mtgStopDate: date called "Jour final"
	repeats: string called "Rpete" class "repeatClasses" with options { "suffixfromclass" "displayifempty" "required" }
	}
	
field class "repeatClasses" |daily| is "Tous les jours" "Tous les jours"
field class "repeatClasses" |weekly| is "Toutes les semaines" "Toutes les semaines"
field class "repeatClasses" |biweekly| is "Toutes les deux semaines" "Toutes les deux semaines"
field class "repeatClasses" |monthly| is "Mensuellement" "Mensuellement"
field class "repeatClasses" |monthlyByWeek| is "Mme semaine du mois" "Mme semaine du mois"
field class "repeatClasses" |yearly| is "Annuellement" "Annuellement"
field class "repeatClasses" |yearlyByWeek| is "Mme semaine de l'anne" "Mme semaine de l'anne"
field class "repeatClasses" |other| is "Etc." ""


// To Do Application
application "todo" called "T	ches a effectuer" with options { "nofolders" "readonly" }

// To Do Soup
soup "To Do List" called "T	ches a effectuer" of "todo" range "dateRange"

overview "todo:date" called "Par Date" of "To Do List" queries "date" contains
	{
	column "Date" width 115 is date
	}

class "todo" called "T	ches a effectuer" of "To Do List" with options { "readonly" } contains
	{
	|date|: date called "Date"
	topics: set called "T	ches" { entry called "T	ches a effectuer" contains
			{
			mtgdone: boolean called "Termine"
			mtgPriority: integer called "Priorite"
			text: text called "Texte"
			}
		}
	}
	

range "dateRange" called "Aujourd'hui" is "<range> [ daystart ... daystart + 1d )"
range "dateRange" called "Cette Semaine" is "<range> [ weekstart ... weekstart + 1w )"
range "dateRange" called "Semaine Prochaine" is "<range> [ weekstart + 1w ... weekstart + 2w )"
range "dateRange" called "Ce Mois" is "<range> [ monthstart ... monthstart + 1m )"
range "dateRange" called "30 Prochains Jours" is "<range> [ daystart ... daystart + 30d )"
range "dateRange" called "60 Prochains Jours" is "<range> [ daystart ... daystart + 60d )"
range "dateRange" called "90 Prochains Jours" is "<range> [ daystart ... daystart + 90d )"
range "dateRange" called "120 Prochains Jours" is "<range> [ daystart ... daystart + 120d )"
range "dateRange" called "180 Prochains Jours" is "<range> [ daystart ... daystart + 180d )"
range "dateRange" called "365 Prochains Jours" is "<range> [ daystart ... daystart + 365d )"
range "dateRange" called "Les 30 Derniers Jours" is "<range> [ daystart - 30d ... daystart )"
range "dateRange" called "Les 60 Derniers Jours" is "<range> [ daystart - 60d ... daystart )"
range "dateRange" called "Les 90 Derniers Jours" is "<range> [ daystart - 90d ... daystart )"
range "dateRange" called "Les 120 Derniers Jours" is "<range> [ daystart - 120d ... daystart )"
range "dateRange" called "Les 180 Derniers Jours" is "<range> [ daystart - 180d ... daystart )"

range "optionalDateRange" called "Tout" is "<range> [ ... ]"
range "optionalDateRange" called "Aujourd'hui" is "<range> [ daystart ... daystart + 1d )"
range "optionalDateRange" called "Ce Semaine" is "<range> [ weekstart ... weekstart + 1w )"
range "optionalDateRange" called "Semaine Prochaine" is "<range> [ weekstart + 1w ... weekstart + 2w )"
range "optionalDateRange" called "Ce Mois" is "<range> [ monthstart ... monthstart + 1m )"
range "optionalDateRange" called "30 Prochains Jours" is "<range> [ daystart ... daystart + 30d )"
range "optionalDateRange" called "30 Prochains Jours" is "<range> [ daystart ... daystart + 60d )"
range "optionalDateRange" called "90 Prochains Jours" is "<range> [ daystart ... daystart + 90d )"
range "optionalDateRange" called "120 Prochains Jours" is "<range> [ daystart ... daystart + 120d )"
range "optionalDateRange" called "180 Prochains Jours" is "<range> [ daystart ... daystart + 180d )"
range "optionalDateRange" called "365 Prochains Jours" is "<range> [ daystart ... daystart + 365d )"
range "optionalDateRange" called "Les 30 Derniers Jours" is "<range> [ daystart - 30d ... daystart )"
range "optionalDateRange" called "Les 60 Derniers Jours" is "<range> [ daystart - 60d ... daystart )"
range "optionalDateRange" called "Les 90 Derniers Jours" is "<range> [ daystart - 90d ... daystart )"
range "optionalDateRange" called "Les 120 Derniers Jours" is "<range> [ daystart - 120d ... daystart )"
range "optionalDateRange" called "Les 180 Derniers Jours" is "<range> [ daystart - 180d ... daystart )"

range "textRange" called "Tout" is "<range> [ ... ]"
range "textRange" called "#..D" is "<range> [ ... \"E\" )"
range "textRange" called "E..H" is "<range> [ \"E\" ... \"I\" )"
range "textRange" called "I..L" is "<range> [ \"I\" ... \"M\" )"
range "textRange" called "M..P" is "<range> [ \"M\" ... \"Q\" )"
range "textRange" called "Q..T" is "<range> [ \"Q\" ... \"U\" )"
range "textRange" called "U..X" is "<range> [ \"U\" ... \"Y\" )"
range "textRange" called "Y..Z" is "<range> [ \"Y\" ... ]"

// Calls Application
application "callapp" called "Coups de Tl." with options { "readonly" }

// Calls Soup
soup "Calls" called "Coups de Tl." of "callapp"

overview "calls:date" called "Par Date" of "Calls" queries "timestamp" 
contains
	{
	column "Date" width 115 is timestamp
	column "Titre" width 150 is title
	}
	
class "calllog" called "Coups de Tl." of "Calls" contains
	{
	timestamp: datetime called "Date"
	title: string called "Titre"
	name: string called "Nom"
	phoneNumber: string called "Nombre"
	notes: note called "Histoire"
	}
